import { defHttp } from '/@/utils/http/axios';
import { DemoParams, DemoListGetResultModel, HouseListGetResultModel } from './model/tableModel';

enum Api {
  DEMO_LIST = '/table/getDemoList',
  GRAFFITI_LIST = '/graffiti/list',
  GRAFFITI_INFO = '/graffiti/list',
  TRACK_INFO = '/graffiti/list',
  PHOTO_LIST = '/photo/list',
  HOUSE_LIST = '/houses/search-attr',
}

/**
 * @description: Get sample list value
 */

export const placeResidentListApi = (params: any) =>
  defHttp.get({
    url: `/houses/${params.id}/fire-safety/place-resident/list`,
    params: {
      pczt: params.pczt,
      pageIndex: params.page - 1,
      limit: params.pageSize,
    },
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const placeCommercialListApi = (params: any) =>
  defHttp.get({
    url: `/houses/${params.id}/fire-safety/place-commercial/list`,
    params: {
      pczt: params.pczt,
      pageIndex: params.page - 1,
      limit: params.pageSize,
    },
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });


export const placeHistoryResidentListApi = (params: any) =>
  defHttp.get({
    url: `/houses/${params.id}/fire-safety/place-resident/${params.pid}/check-result/history-list`,
    params: {
      pczt: params.pczt,
      pageIndex: params.page - 1,
      limit: params.pageSize,
    },
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const placeHistoryCommercialListApi = (params: any) =>
  defHttp.get({
    url: `/houses/${params.id}/fire-safety/place-commercial/${params.pid}/check-result/history-list`,
    params: {
      pczt: params.pczt,
      pageIndex: params.page - 1,
      limit: params.pageSize,
    },
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const detailResidentApi = (params: any) =>
  defHttp.get({
    url: `/houses/${params.hid}/fire-safety/place-resident/${params.pid}/info`,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const detailCommercialApi = (params: any) =>
  defHttp.get({
    url: `/houses/${params.hid}/fire-safety/place-commercial/${params.pid}/info`,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const detailHistoryResidentApi = (params: any) =>
  defHttp.get({
    url: `/houses/fire-safety/place-resident/check-result/history-list/${params.pid}/info`,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const detailHistoryCommercialApi = (params: any) =>
  defHttp.get({
    url: `/houses/fire-safety/place-commercial/check-result/history-list/${params.pid}/info`,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const demoListApi = (params: DemoParams) =>
  defHttp.get<DemoListGetResultModel>({
    url: Api.DEMO_LIST,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const houseApi = (params: any) =>
  defHttp.get<HouseListGetResultModel>({
    url: `/houses/${params.id}/info`,
    params: {
      id: params.id,
    },
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const trackApi = (params: any) =>
  defHttp.get<DemoListGetResultModel>({
    url: `/track/${params.id}/info`,
    params: {
      id: params.id,
    },
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const graffitiListApi = (params: DemoParams) =>
  defHttp.get<DemoListGetResultModel>({
    url: Api.GRAFFITI_LIST,
    params: {
      pageIndex: params.page - 1,
      limit: params.pageSize,
    },
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const photoListApi = (params: DemoParams) =>
  defHttp.get<DemoListGetResultModel>({
    url: Api.PHOTO_LIST,
    params: {
      pageIndex: params.page - 1,
      limit: params.pageSize,
    },
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
